<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta name="author" content="lijinbo" />
    <title>143-css绘制一颗心</title>
    <style>
      body {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 80vh;
      }
      :root {
        --w: 20vw;
      }
      .heart {
        position: relative;
        width: 50%;
        height: 50vh;
      }
      .heart:before,
      .heart:after {
        position: absolute;
        content: '';
        left: var(--w);
        top: 0;
        width: var(--w);
        height: calc(var(--w) * 1.6);
        background: red;
        border-radius: var(--w) var(--w) 0 0;
        transform: rotate(-45deg);
        transform-origin: 0 100%;
      }
      .heart:after {
        left: 0;
        transform: rotate(45deg);
        transform-origin: 100% 100%;
      }
    </style>
  </head>
  <body>
    <div class="heart"></div>
  </body>
</html>
